About Tag Objects
A tag object is a private data structure whose purpose is to allow any kind of application-defined information to be attached to a QuickDraw GX object. An object such as a shape or transform can be "tagged" with data or code that alters its behavior in specific situations or provides extra information about it. For example, you can attach identifying strings to objects with tags, or you can alter the way an object is displayed on a particular imaging device by attaching a tag to it that contains imaging commands specific to that device. For example, QuickDraw GX uses tag objects to hold PostScript commands used for printing to PostScript devices.QuickDraw GX identifies an individual tag object through a tag reference. To obtain information about a tag object, you must send its reference as a parameter to a QuickDraw GX function (except that you can determine if two references identify the same tag object simply by comparing them for equality, and you can examine a reference to see if it is
nil
).Tag objects are further identified by tag type, a designation that you can use to identify the tag object's purpose and format.
A tag object is attached to its associated object by means of a tag list, a property that most QuickDraw GX objects have. A tag list is an array of references to the tag objects attached to an object. Objects can thus have more than one attached tag object. You cannot attach a tag object to a printing object, a font object, a graphics client object, or a tag object itself; there is no tag list property for those objects.
Because tags are QuickDraw GX objects, they can be shared. A single tag object can be attached to more than one other object; the owner count of the tag object tells you how many references to it exist. Tags also have all the other advantages of QuickDraw GX objects: they are accessible from objects in accelerator memory, they can be unloaded to disk and reloaded automatically, and they can be flattened and included in a spool file.
Subtopics
- Tag Object Properties
- Tag Types
- Uses for Tag Objects